<% layout('/layout/default.html', {title: '业务表', libs: ['dataGrid']}){ %>
<div class="main-content">
	<div class="card-header">
		<i class="fa fa-sitemap"></i> 业务表
		<div class="header-tools float-right">
			<a href="#" class="btn btn-default btn-sm" id="btnSearch" title="查询"><i class="fa fa-filter"></i> 查询</a>
			<% if(hasPermi('sys:dict:edit')){ %>
			<a href="/gen/genTable/formAdd" class="btn btn-default btn-sm btnTool" title="新增业务表"><i class="fa fa-plus"></i> 新增</a>
			<% } %>
		</div>
	</div>
	<div class="container-fluid">
		<form id="searchForm" action="${ctx}/gen/genTable/listData" class="form-inline d-none">
			<div class="form-group">
				<label class="control-label">表名：</label>
				<div class="control-inline">
					<input name="nameLike" maxlength="50" class="form-control form-control-sm"/>
				</div>
			</div>
			<div class="form-group">
				<label class="control-label">说明：</label>
				<div class="control-inline">
					<input name="comments" maxlength="50" class="form-control form-control-sm"/>
				</div>
			</div>
			<div class="form-group">
				<label class="control-label">父表表名：</label>
				<div class="control-inline">
					<input name="parentTable" maxlength="50" class="form-control form-control-sm"/>
				</div>
			</div>
			<div class="form-group">
				<button type="submit" class="btn btn-success btn-sm ">查询</button>
				<button id="reset" type="reset" class="btn btn-default btn-sm">重置</button>
			</div>
		</form>
		<table id="dataGrid"></table>
	</div>
</div>
<% } %>
<script>

	$('#dataGrid').dataGrid({
		searchForm: $("#searchForm"),
		columnModel: [
			{header:'表名', name:'name', index:'a.name', width:90, align:"center"},
			{header:'说明', name:'comments', index:'a.comments', width:140, align:"center"},
			{header:'类名', name:'className', index:'a.class_name', width:120, align:"center"},
			{header:'父表', name:'parentTable', index:'a.parent_table', width:100, align:"center"},
			{header:'操作', name:'actions', width:100, sortable:false, title:false, align:"center",formatter: function(val, obj, row, act){
					var actions = [];
				<% if(hasPermi('gen:genTable:edit')){ %>
						actions.push('<a href="/gen/genTable/formEdit?id='+row.id+'" class="btnList" title="编辑业务表"><i class="fas fa-pencil-alt"></i></a>&nbsp;');
					<% } %>
				<% if(hasPermi('gen:genTable:edit')){ %>
						actions.push('<a href="${ctx}/gen/genTable/delete?id='+row.id+'" class="btnList" title="删除业务表" data-confirm="确认要删除该业务表吗？"><i class="far fa-trash-alt"></i></a>&nbsp;');
					<% } %>

					return actions.join('');
				}}
		],
		// 加载成功后执行事件
		ajaxSuccess: function(data){

		}
	});

</script>